async function info() {
        const app = Vue.createApp({
            data() {
                return {
                    user: {},
					yiyan: {},
					// info: {},
					currentPage: 1,
					pageSize: 5,
					total: 0,
					currentPageData: [],

					Return_currentPage: 1,
					Return_pageSize: 5,
					Return_total: 0,
					Return_currentPageData: [],
					
					pass_currentPage: 1,
					pass_pageSize: 5,
					pass_total: 0,
					pass_currentPageData: [],
                }
            },
			async created() {
				this.user = await this.getUserName(); // 在组件创建后立即获取用户实体
				// this.info = await this.getInfos();
				this.yiyan = await this.getyiyan();
			},
			methods: {
				async getUserName() {
					var user = await get_info(User_Information_Link);//http://127.0.0.1:6066/api/user/userInfo、../user.json
					if(user.code==0){
						return user.data;
					}else{
						showPop("获取用户信息失败","error");
						showPop("原因："+user.message,"warning");
					}
				},
				async getyiyan() {
					var yiyan = await get_info(yiyan_Link);
					return yiyan.data;
				},
				async fetchData(page) {
				    try {
				        const response = await fetch(Get_Book_List_Link+`?pageNum=${page}&pageSize=${this.pageSize}`);//http://127.0.0.1:6066/api/article/oneself?pageNum=${page}&pageSize=${this.pageSize}
				        if (!response.ok) {
				            throw new Error(`HTTP error! status: ${response.status}`);
				        }
				        const data = await response.json();
					
				        if (data.code === 0) {
				            this.total = data.data.total;
				            this.currentPageData = data.data.items; // 直接更新当前页面的数据
				        } else {
				            console.error(data.message);
				        }
				    } catch (error) {
				        console.error('There was a problem with the fetch operation:', error);
				    }
				},
				goToPage(page) {
				    if (page >= 1 && page <= this.totalPages) {
				        this.currentPage = page;
				        this.fetchData(page);
				    }
				},
				getToggleTarget(book_id) {return `target: #modal-example${book_id}`;},
				async borrow(bookID){
					var borrowInfo = await patch_info(Borrow_Book_Link+`?id=${bookID}`,{});
					if(borrowInfo.code==0){
						showPop("借阅成功","success");
						await this.fetchData(this.currentPage);
						await this.Return_fetchData(this.Return_currentPage);
					}else{
						showPop("借阅失败","error");
						showPop("原因："+borrowInfo.message,"warning");
					}
				},
				async Return_fetchData(page) {
				    try {
				        const response = await fetch(Return_Get_Book_List_Link+`?pageNum=${page}&pageSize=${this.Return_pageSize}&book_status=1`);//http://127.0.0.1:6066/api/article/oneself?pageNum=${page}&pageSize=${this.pageSize}
				        if (!response.ok) {
				            throw new Error(`HTTP error! status: ${response.status}`);
				        }
				        const data = await response.json();
					
				        if (data.code === 0) {
				            this.Return_total = data.data.total;
				            this.Return_currentPageData = data.data.items; // 直接更新当前页面的数据
				        } else {
				            console.error(data.message);
				        }
				    } catch (error) {
				        console.error('There was a problem with the fetch operation:', error);
				    }
				},
				Return_goToPage(page) {
				    if (page >= 1 && page <= this.Return_totalPages) {
				        this.Return_currentPage = page;
				        this.Return_fetchData(page);
				    }
				},
				Return_getToggleTarget(book_id) {return `target: #Return_modal-example${book_id}`;},
				async Return(bookID){
					var Return_Info = await patch_info(Return_Book_Link+`?id=${bookID}`,{});
					if(Return_Info.code==0){
						showPop("归还成功","success");
						showPop("等待管理员审核","success");
						await this.fetchData(this.currentPage);
						await this.Return_fetchData(this.Return_currentPage);
						await this.pass_fetchData(this.pass_currentPage);
					}else{
						showPop("归还失败","error");
						showPop("原因："+Return_Info.message,"warning");
					}
				},
				async pass_fetchData(page) {
				    try {
				        const response = await fetch(Get_Book_List_Link+`?pageNum=${page}&pageSize=${this.pageSize}&book_status=2`);//http://127.0.0.1:6066/api/article/oneself?pageNum=${page}&pageSize=${this.pageSize}
				        if (!response.ok) {
				            throw new Error(`HTTP error! status: ${response.status}`);
				        }
				        const data = await response.json();
					
				        if (data.code === 0) {
				            this.pass_total = data.data.total;
				            this.pass_currentPageData = data.data.items; // 直接更新当前页面的数据
				        } else {
				            console.error(data.message);
				        }
				    } catch (error) {
				        console.error('There was a problem with the fetch operation:', error);
				    }
				},
				pass_goToPage(page) {
				    if (page >= 1 && page <= this.pass_totalPages) {
				        this.pass_currentPage = page;
				        this.pass_fetchData(page);
				    }
				},
				async pass(bookID){
					var borrowInfo = await patch_info(Pass_Book_Link+`?id=${bookID}`,{});
					if(borrowInfo.code==0){
						showPop("审核成功","success");
						await this.fetchData(this.currentPage);
						await this.Return_fetchData(this.Return_currentPage);
						await this.pass_fetchData(this.pass_currentPage);
					}else{
						showPop("审核失败","error");
						showPop("原因："+borrowInfo.message,"warning");
					}
				},
				async offBook(bookID){
					var borrowInfo = await patch_info(Off_Book_Link+`?id=${bookID}`,{});
					if(borrowInfo.code==0){
						showPop("下架成功","success");
						await this.fetchData(this.currentPage);
					}else{
						showPop("下架失败","error");
						showPop("原因："+borrowInfo.message,"warning");
					}
				},
				async deleteBook(){
					var borrowInfo = await delete_info(Delete_Book_Link+`?id=`+$('#delete_book_id').val(),{});
					if(borrowInfo.code==0){
						showPop("删除成功","success");
						await this.fetchData(this.currentPage);
					}else{
						showPop("删除失败","error");
						showPop("原因："+borrowInfo.message,"warning");
					}
				},
				async outLogin(){
					var borrowInfo = await get_info(Login_Out_Link);
					if(borrowInfo.code==0){
						showPop("退出登录成功","success");
						showPop("正在转跳至主页","success");
						setTimeout(function() {
						  document.location.replace('/');
						}, 2000);
					}else{
						showPop("退出登录失败","error");
						showPop("原因："+borrowInfo.message,"warning");
					}
				},
				gotoTop(){
					// window.location.hash = "#commenting";
					$("#top")[0].scrollIntoView({behavior: "smooth"});
				},
				async addBook(){
					var bookInfo = await post_info(Add_Book_Link,{
						"book_name": $("#book_name").val(),
						"book_isbn": $("#book_isbn").val(),
						"book_press": $("#book_press").val(),
						"book_author": $("#book_author").val(),
						"book_pagination": $("#book_pagination").val(),
						"book_price": $("#book_price").val()
						});
					if(bookInfo.code==0){
						showPop("上传成功","success");
						await this.fetchData(this.currentPage);
						await this.Return_fetchData(this.Return_currentPage);
						await this.pass_fetchData(this.pass_currentPage);
						document.querySelectorAll('.uk-nav-default li').forEach(function(li) {
						    li.classList.remove('uk-active');
						});
						// 为当前导航项添加uk-active类
						document.querySelectorAll('.uk-nav-default li')[1].classList.add('uk-active');
						var switcher = UIkit.switcher('.switcher-container');
						switcher.show(1);
						
						var inputs = document.querySelectorAll('input[type="text"]');
						    // 遍历所有输入框
						inputs.forEach(function(input) {
						    input.value = '';
						});
					}else{
						showPop("上传失败","error");
						showPop("原因："+bookInfo.message,"warning");
					}
				}
			},
			computed: {
			    totalPages() {
			        return Math.ceil(this.total / this.pageSize);
			    },
				Return_totalPages() {
				    return Math.ceil(this.Return_total / this.Return_pageSize);
				},
				pass_totalPages() {
				    return Math.ceil(this.pass_total / this.pass_pageSize);
				},
			},
	        mounted() {
	            this.fetchData(this.currentPage);
				this.Return_fetchData(this.Return_currentPage);
				this.pass_fetchData(this.pass_currentPage);
	        },
        });
		app.mount('#info');
    
}
info();